package com.suixinsanren.design.state.study.demo04;

import org.junit.Before;
import org.junit.Test;

public class GumballMachineTestDrive {

    private GumballMachine gumballMachine;

    @Before
    public void init() {
        gumballMachine = new GumballMachine(1);
    }

    @Test
    public void test1() {
        gumballMachine.insertQuarter();
        gumballMachine.turnCrank();
        gumballMachine.insertQuarter();
        gumballMachine.turnCrank();
    }

    @Test
    public void test2() {
        gumballMachine.insertQuarter();
        gumballMachine.turnCrank();
        gumballMachine.insertQuarter();
        gumballMachine.turnCrank();
        gumballMachine.turnCrank();
        gumballMachine.turnCrank();
        gumballMachine.turnCrank();
    }

    @Test
    public void test3() {
        gumballMachine.insertQuarter();
        gumballMachine.turnCrank();
        gumballMachine.insertQuarter();
        gumballMachine.turnCrank();

        gumballMachine.refill(3);

        gumballMachine.insertQuarter();
        gumballMachine.turnCrank();

        gumballMachine.insertQuarter();
        gumballMachine.turnCrank();

        gumballMachine.insertQuarter();
        gumballMachine.turnCrank();

        gumballMachine.insertQuarter();
        gumballMachine.turnCrank();

    }
}
